package com.sk.dao;

import java.util.List;

import org.hibernate.Session;





import com.sk.action.OrderAction;
import com.sk.action.OrderBean;
import com.sk.pojo.Detail;
import com.sk.pojo.Order;
import com.sk.pojo.User;



public class OrderDao implements BaseDao2<Order> {
	public boolean save(com.sk.pojo.Order object) {
		Session session = getSession();
		try {
			session.beginTransaction();
			session.save(object);
			session.getTransaction().commit();
			
			return true;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			session.getTransaction().rollback();
		
		}
		return false;
	}

	private Session getSession() {
		// TODO Auto-generated method stub
		return null;
	}

	public Object get(Order object) {
		    Session session = getSession();
			session.beginTransaction();
			Order order  = (Order) session.get(Detail.class,object.getOid());
			
			return order;
	}

	public boolean delete(Order object) {
		Session session = getSession();
			try {
				session.beginTransaction();
				session.delete(object);
				session.getTransaction().commit();			
				
				return true;
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				session.getTransaction().rollback();
			
		}
		return false;
	}

	public boolean update(Order object) {
		Session session = getSession();
			try {
				session.beginTransaction();
				session.update(object);
				session.getTransaction().commit();			
				
				return true;
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				session.getTransaction().rollback();
			
			}
		return false;
	}

	public List<User> save(User user) {
		// TODO Auto-generated method stub
		return null;
	}

	public OrderAction getDetailOrder(String ono) {
		// TODO Auto-generated method stub
		return null;
	}

	
	public List<OrderBean> getAllOrder() {
		// TODO Auto-generated method stub
		return null;
	}

}

